﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="testreportmanager._Default" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <p>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        
        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/sample.xml" 
            XPath="/TestRun/ResultSummary/Counters"></asp:XmlDataSource></p>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:GridView ID="Summary" runat="server" AutoGenerateColumns="False" CellPadding="4"
                DataSourceID="XmlDataSource1" ForeColor="#333333" GridLines="None" 
                Visible="False">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:TemplateField HeaderText="Total" SortExpression="total">
                        <ItemTemplate>
                            <asp:LinkButton ID="totallnk" runat="server" OnClick="totallnk_Click" Text='<%# Eval("total") %>'></asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle Font-Bold="False" ForeColor="#FF3300" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="executed" HeaderText="Executed" SortExpression="executed" />
                    <asp:BoundField DataField="passed" HeaderText="Passed" SortExpression="passed">
                        <ItemStyle Font-Bold="False" ForeColor="Lime" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="Failed" SortExpression="failed">
                        <ItemTemplate>
                            <asp:LinkButton ID="failedlnk" runat="server" OnClick="failedlnk_Click" Text='<%# Eval("failed") %>'
                                ForeColor="Red"></asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle Font-Bold="False" ForeColor="#FF3300" />
                    </asp:TemplateField>
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" Font-Size="9pt" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" Font-Size="9pt" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            </asp:GridView>
            <br />
            <br />
            <asp:GridView ID="TestListGrid" runat="server" AutoGenerateColumns="False" CellPadding="4"
                DataKeyNames="id" DataSourceID="XmlDataSource3" ForeColor="#333333" GridLines="None"
                OnSelectedIndexChanged="GridView3_SelectedIndexChanged" Visible="False">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="name" HeaderText="Test List" SortExpression="name" />
                    <asp:CommandField SelectText="View Details" ShowSelectButton="True" />
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" Font-Size="9pt" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" Font-Size="9pt" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="False" ForeColor="#333333" />
            </asp:GridView>
            <br />
            <asp:GridView ID="CommentsGrid" runat="server" AutoGenerateColumns="False" CellPadding="4"
                DataSourceID="XmlDataSource4" ForeColor="#333333" GridLines="None" 
                Visible="False">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="Comments" HeaderText="Comments" SortExpression="Comments" />
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" Font-Size="9pt" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" Font-Size="9pt" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="False" ForeColor="#333333" />
            </asp:GridView>
            <br />
            <asp:GridView ID="ResultsGrid" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                CellPadding="4" DataKeyNames="testId" DataSourceID="XmlDataSource2" ForeColor="#333333"
                GridLines="None" OnSelectedIndexChanged="GridView2_SelectedIndexChanged" Visible="False"
                OnRowDataBound="GridView2_RowDataBound" OnPageIndexChanged="lbFname_Click" 
                PageSize="20">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="testName" HeaderText="Title" 
                        SortExpression="testName" NullDisplayText="No tests here" />
                    <asp:BoundField DataField="outcome" HeaderText="Result" 
                        SortExpression="outcome" NullDisplayText="-" />
                    <asp:CommandField SelectText="View Details" ShowSelectButton="True" />
                </Columns>
                <EditRowStyle BackColor="#999999" Font-Size="Smaller" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" Font-Size="9pt" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" Font-Size="9pt" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="False" ForeColor="#333333" />
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
    <p>
        <asp:XmlDataSource ID="XmlDataSource3" runat="server" DataFile="~/sample.xml" 
            XPath="/TestRun/TestLists/TestList[count(child::*/child)=0 and @parentListId]"></asp:XmlDataSource>
    </p>
    <p>
        <asp:XmlDataSource ID="XmlDataSource2" runat="server" DataFile="~/sample.xml" 
            XPath="/TestRun/Results/*"></asp:XmlDataSource>
        </p>
    <p>
        <asp:XmlDataSource ID="XmlDataSource4" runat="server" DataFile="~/sample.xml" 
            TransformFile="~/comments.xsl" 
            XPath="/Results/*[@testId='17d0f551-2b90-40e0-ad35-db1f8396e246']"></asp:XmlDataSource>
    </p>
</asp:Content>
<asp:Content ID="SideContent" runat="server" ContentPlaceHolderID="SideBar">
    <h2>
        Select Report
    </h2>
    <p>
        <asp:DropDownList ID="featurelist" runat="server" DataSourceID="XmlDataSource7" 
            DataTextField="feature" DataValueField="feature" 
            onselectedindexchanged="featurelist_SelectedIndexChanged" 
            AutoPostBack="True">
        </asp:DropDownList>
        <asp:DropDownList ID="buildlist" runat="server" DataSourceID="XmlDataSource8" 
            DataTextField="build" DataValueField="build">
        </asp:DropDownList>
        <asp:Button ID="bSearch" runat="server" onclick="bSearch_Click" Text="Search" />
        <asp:XmlDataSource ID="XmlDataSource5" runat="server" DataFile="~/files.xml">
        </asp:XmlDataSource>
        <asp:XmlDataSource ID="XmlDataSource7" runat="server" DataFile="~/files.xml" 
            XPath="/folder/file[not(@feature = preceding::file/@feature)]">
        </asp:XmlDataSource>
        <asp:XmlDataSource ID="XmlDataSource8" runat="server" DataFile="~/files.xml" 
            XPath="/folder/file[not(@build = preceding::file/@build)]">
        </asp:XmlDataSource>
        <asp:GridView ID="filesgrid" runat="server" AutoGenerateColumns="False" 
            DataSourceID="XmlDataSource5" Visible="False" CellPadding="4" 
            ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:TemplateField HeaderText="Name" SortExpression="name">                    
                    <ItemTemplate>
                        <asp:LinkButton ID="lbFname" runat="server" onClick="lbFname_Click" Text='<%# Eval("name") %>'></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="feature" HeaderText="Feature" 
                    SortExpression="feature" />
                <asp:BoundField DataField="build" HeaderText="Build" SortExpression="build" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" 
                Font-Size="9pt" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" Font-Size="9pt" />            
        </asp:GridView>
    </p>
</asp:Content>
